package com.prs.crm.service.oa.impl;

import java.io.File;
import java.util.Collection;

import com.prs.crm.context.Attach;
import com.prs.crm.context.Constrains;
import com.prs.crm.context.FileUtil;
import com.prs.crm.dao.oa.OaTaskSubmitDao;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.oa.OaTask;
import com.prs.crm.domain.oa.OaTaskSubmit;
import com.prs.crm.service.impl.BaseServiceImpl;
import com.prs.crm.service.oa.OaTaskSubmitService;

public class OaTaskSubmitServiceImpl extends BaseServiceImpl<OaTaskSubmit,OaTaskSubmitDao> implements OaTaskSubmitService{

	@Override
	public void saveOaTaskSubmit(OaTaskSubmit submit, File file, String fileName) {
		// TODO Auto-generated method stub
		Attach attach = FileUtil.getInstance().saveFile(file, fileName, "", Constrains.UPLOAD_DIR_TASK);
		if(attach.getSrc() != null) {
			submit.setAttach(attach.getSrc());
		}
		this.getDao().save(submit);
	}

	@Override
	public Collection<OaTaskSubmit> getExecuteTask(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getExecuteTask(person);
	}

	@Override
	public Collection<OaTaskSubmit> getAuditTask(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getAuditTask(person);
	}

	@Override
	public Collection<OaTaskSubmit> getOaTaskSubmitByTask(OaTask oaTask) {
		// TODO Auto-generated method stub
		return this.getDao().getOaTaskSubmitByTask(oaTask);
	}

	@Override
	public Collection<OaTaskSubmit> getOverdueOaTaskSubmit(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getOverdueOaTaskSubmit(person);
	}

	@Override
	public Collection<OaTaskSubmit> getExecuteTaskByLevel(Person person,
			String level) {
		// TODO Auto-generated method stub
		return this.getDao().getExecuteTaskByLevel(person, level);
	}

	@Override
	public Collection<OaTaskSubmit> getAuditTaskByLevel(Person person,
			String level) {
		// TODO Auto-generated method stub
		return this.getDao().getAuditTaskByLevel(person ,level);
	}

}
